/**
  ******************************************************************************
  * @file           : Task_config.c
  * @brief          : User should configure and deploy task in this file.
  *                  
  ******************************************************************************
	*Before running your task, you should first include your headers and extern 
	 used Semaphores.
	*All tasks should be created in "creatUserTasks()"
**/


#include "Task_config.h"
/**********Variables & Structs*************/
struct DataSet_Position_PID MotorSpeed;
struct Data_Motor Motor1;
/**************Semaphores******************/


/**************Founctions******************/
__task void testMotor(void);
//初始化用户模块、创建启动任务
void startup(void)
{	
	/****Initialization for moudles***/
	bsp_Init();
	Position_PID_Init(&MotorSpeed,4000,0);
	semaphoreInit();
	printf(	"\n\r***********************************************(C) COPYRIGHT 2018***********************************************\r\n"
								"*                                                                                                              *\r\n"
								"*                                                 RoboLab 2019										           *\r\n"
								"*                                                                                                              *\r\n"
								"*                                				Test for CAN & MPU										       *\r\n"
								"*                                                                                                              *\r\n"
								"*                                                 [DEBUG MODE]                                                 *\r\n"
								"****************************************************************************************************************\r\n"
								"Initialize success!\r\n");	
	/******Start the kernel***********/
	os_sys_init_prio(creatUserTasks,254);	
}

//用户任务在以下函数中创建
__task void creatUserTasks(void)
{
	/********User code begin**********/
	os_tsk_create(testMotor,4);
	/********User code end  **********/
	os_tsk_delete_self();
}

extern u8 CAN1_RX_BUFF[8];
__task void testMotor(void)
{
	for(;;)
	{
		for(int t=0;t<=7;t++)
		{
			if(t==7)t=0;
			delay_ms_nos(1);
			Motor1.target_rpm = 100;
			Set_SingleMotor(Motor1.ID,Motor1.target_rpm); 
		}
	}
}









void semaphoreInit(void)
{

}



